using System;
using StackExchange.Redis;

namespace blog.Lib
{
    public class RedisClient
    {
        private ConnectionMultiplexer redis;
        private IDatabase db { set; get; }
        private const string connection = "127.0.0.1:6379,password=123456";

        public RedisClient()
        {
            redis = ConnectionMultiplexer.Connect(connection);
            db = redis.GetDatabase();
        }

        public bool SetStringValue(string key, string value)
        {
            return db.StringSet(key, value);
        }

        public string GetStringValue(string key)
        {
            return db.StringGet(key);
        }
        
    }
}
